﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.Mirror.CliMetadata
{
	class CliMethodBody : MethodBody
	{
		public CliMethodBody(
			int maxStackSize,
			bool initLocals,
			byte[] bytes,
			int localSignatureToken,
			CliLocalInfo[] locals,
			ExceptionHandlingClause[] clauses
			)
		{
			if (bytes == null) throw new ArgumentNullException("bytes");

			this._maxStackSize = maxStackSize;
			this._bytes = bytes;
			this._localSigToken = localSignatureToken;
			this._locals = locals;
			this._initLocals = initLocals;
			this._clauses = clauses;
		}

		private byte[] _bytes;
		public override byte[] GetILAsByteArray()
		{
			return this._bytes;
		}

		private int _localSigToken;
		public override int LocalSignatureMetadataToken
		{
			get { return this._localSigToken; }
		}

		private CliLocalInfo[] _locals;
		public override IList<LocalVariableInfo> LocalVariables
		{
			get { return this._locals; }
		}

		private bool _initLocals;
		public override bool InitLocals
		{
			get
			{
				return this._initLocals;
			}
		}

		private int _maxStackSize;
		public override int MaxStackSize
		{
			get
			{
				return this._maxStackSize;
			}
		}

		private ExceptionHandlingClause[] _clauses;
		public override IList<ExceptionHandlingClause> ExceptionHandlingClauses
		{
			get
			{
				return this._clauses;
			}
		}
	}
}
